package com.shop2cn.iapi.sqpayment.testcase;

import java.math.BigDecimal;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.sqpayment.parameter.QueryHipoWechatForexRateBean;
import com.shop2cn.iapi.sqpayment.service.QueryHipoWechatForexRateCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
/**
*hipopay汇率查询
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_QueryHipoWechatForexRate{
	private static QueryHipoWechatForexRateBean queryhipowechatforexrateBean;
	private static QueryHipoWechatForexRateCall queryhipowechatforexrateCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("hipopay汇率查询");
	}

	@Before
	public void caseUp() {
		queryhipowechatforexrateBean=new QueryHipoWechatForexRateBean();
		queryhipowechatforexrateCall=new QueryHipoWechatForexRateCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(queryhipowechatforexrateCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryHipoWechatForexRate_001() {
		Logger.start(true,"hipopay汇率查询成功");
		try {
			queryhipowechatforexrateBean.setCurrency("USD");
			queryhipowechatforexrateCall.setData(queryhipowechatforexrateBean);
			queryhipowechatforexrateCall.callService();			
			Logger.verifyEquals("0", queryhipowechatforexrateCall.getString("ErrorCode"), "ErrorCode");
			Logger.verifyEquals("true", queryhipowechatforexrateCall.getString("IsSuccess"), "IsSuccess");
			Logger.debug(BigDecimal.valueOf(1).divide(new BigDecimal(queryhipowechatforexrateCall.getString("ForexRate")),10,BigDecimal.ROUND_HALF_UP));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryHipoWechatForexRate_002() {
		Logger.start(true,"不输入参数hipopay汇率查询失败");
		try {
//			queryhipowechatforexrateBean.setCurrency("USD");
			queryhipowechatforexrateCall.setData(queryhipowechatforexrateBean);
			queryhipowechatforexrateCall.callService();			
			Logger.verifyEquals("1000", queryhipowechatforexrateCall.getString("ErrorCode"), "ErrorCode");
			Logger.verifyEquals("false", queryhipowechatforexrateCall.getString("IsSuccess"), "IsSuccess");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryHipoWechatForexRate_003() {
		Logger.start(true,"参数输入错误hipopay汇率查询失败");
		try {
			queryhipowechatforexrateBean.setCurrency("hk");
			queryhipowechatforexrateCall.setData(queryhipowechatforexrateBean);
			queryhipowechatforexrateCall.callService();			
			Logger.verifyEquals("5000", queryhipowechatforexrateCall.getString("ErrorCode"), "ErrorCode");
			Logger.verifyEquals("false", queryhipowechatforexrateCall.getString("IsSuccess"), "IsSuccess");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}